//工具类


// 获取随机数
export const getRandomInt = (min, max) => {
	min = Math.ceil(min);
	max = Math.floor(max);
	return Math.floor(Math.random() * (max - min) + min);
}
//格式化时间
export const formatTime = (time) => {
	let differSecond = time;
	let day = Math.floor(differSecond / (60 * 60 * 24));
	day = day >= 10 ? day : "0" + day;
	let hour = Math.floor(differSecond / (60 * 60) % 24);
	hour = hour >= 10 ? hour : "0" + hour;
	let minute = Math.floor(differSecond / 60 % 60);
	minute = minute >= 10 ? minute : "0" + minute;
	let second = Math.floor(differSecond % 60);
	second = second >= 10 ? second : "0" + second;
	return {
		day,
		hour,
		minute,
		second
	}
}
//设置本地存储
export const setLocalStorage = (key, value) => {
	window.localStorage.setItem(key, JSON.stringify(value))
}
//获取本地存储
export const getLocalStorage = (key) => {
	return JSON.parse(window.localStorage.getItem(key))
}
